<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>生活用品商店-后台管理</title>
	<link rel="shortcut icon" href="__PUBLIC__/images//favicon.ico">
	<link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/bootstrap-theme.min.css" />
	<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
</head>

<body>

	<div class="container">
		<form action="?m=Admin&c=admin&a=load" method="post" onsubmit="return checkForm()"
			style="width: 30%; margin: 60px auto;">
			<div class="form-group">
				<label for="u_name">用户名</label>
				<input type="text" class="form-control" placeholder="用户名" name="aname" id="aname">
			</div>
			<div class="form-group">
				<label for="u_pwd">密码</label>
				<input type="password" class="form-control" placeholder="密码" name="apwd" id="apwd">
			</div>
			<div class="form-group">
				<label for="validation">验证码</label>
				<input type="text" class="form-control" placeholder="验证码" name="validation" id="validation">
				<img src="{$address}/image_validation.php" alt="" id="code_img">
				<a href="#" id="change" onclick="getValidation('{$address}')">看不清楚，换一张</a><br>
			</div>
			<button type="submit" class="btn btn-primary btn-lg btn-block">登 陆</button>
		</form>
	</div>
</body>

<script type="text/javascript">
	//刷新验证码
	function getValidation(address) {
		var img = document.getElementById("code_img");
		//将img的src属性重新设置
		img.src = address + "/image_validation.php?t=" + new Date().getTime(); //获取时间防止图片缓存
		return false;//防止页面跳转
	}
	//初步非空检测
	function checkForm() {
		var name = document.getElementById('aname').value;
		var pwd = document.getElementById('apwd').value;
		var v = document.getElementById('validation').value;
		if (v == '') {
			alert("请输入验证码！");
			return false;
		}
		if (name == '') {
			alert("请输入用户名！");
			return false;
		}
		if (pwd == '') {
			alert("请输入密码！");
			return false;
		}
		return true;
	}
</script>

</html>